package com.ctvit.sjk.knowledge.document.pojo.vo;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ctvit.sjk.knowledge.document.pojo.domain.TabDocument;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDateTime;

/**
 * 文档查询VO
 *
 * @author heyingcheng
 * @date 2025/03/25
 */
@Getter
@Setter
@ToString
public class DocumentGetVO {

    private String id;
    @JsonProperty("dataset_id")
    private String datasetId;
    private String name;
    @JsonProperty("char_length")
    private Integer charLength;
    private String status;
    @JsonProperty("is_active")
    private Boolean isActive;
    private String type;
    private JSONObject meta;
    @JsonProperty("hit_handling_method")
    private String hitHandlingMethod;
    @JsonProperty("directly_return_similarity")
    private Double directlyReturnSimilarity;
    @JsonProperty("status_meta")
    private String statusMeta;
    @JsonProperty("paragraph_count")
    private Integer paragraphCount;
    @JsonProperty("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @JsonProperty("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    public DocumentGetVO(TabDocument entity) {
        this.id = entity.getDocumentId();
        this.datasetId = entity.getDatasetId();
        this.name = entity.getDocumentName();
        this.charLength = entity.getCharLength();
        this.status = entity.getDocumentStatus();
        this.isActive = entity.getActiveFlag();
        this.type = entity.getDocumentType();
        this.meta = JSON.parseObject(entity.getDocumentMetadata());
        this.hitHandlingMethod = entity.getHitHandlingMethod();
        this.directlyReturnSimilarity = entity.getDirectlyReturnSimilarity();
        this.statusMeta = entity.getStatusMetadata();
        this.paragraphCount = entity.getParagraphCount();
        this.createTime = entity.getCreateTime();
        this.updateTime = entity.getUpdateTime();
    }

}
